Nightly Per-Antenna Quality Summary Notebook¶

Josh Dillon, Last Revised February 2021

This notebooks brings together as much information as possible from ant_metrics, auto_metrics and redcal to help figure out which antennas are working properly and summarizes it in a single giant table. It is meant to be lightweight and re-run as often as necessary over the night, so it can be run when any of those is done and then be updated when another one completes.

Contents:¶

  • Table 1: Overall Array Health
  • Table 2: RTP Per-Antenna Metrics Summary Table
  • Figure 1: Array Plot of Flags and A Priori Statuses
In [1]:
import os
os.environ['HDF5_USE_FILE_LOCKING'] = 'FALSE'
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import pandas as pd
pd.set_option('display.max_rows', 1000)
from hera_qm.metrics_io import load_metric_file
from hera_cal import utils, io, redcal
import glob
import h5py
from copy import deepcopy
from IPython.display import display, HTML
from hera_notebook_templates.utils import status_colors
from hera_mc import mc
from pyuvdata import UVData

%matplotlib inline
%config InlineBackend.figure_format = 'retina'
display(HTML("<style>.container { width:100% !important; }</style>"))
In [2]:
# If you want to run this notebook locally, copy the output of the next cell into the first few lines of this cell.

# JD = "2459122"
# data_path = '/lustre/aoc/projects/hera/H4C/2459122'
# ant_metrics_ext = ".ant_metrics.hdf5"
# redcal_ext = ".maybe_good.omni.calfits"
# nb_outdir = '/lustre/aoc/projects/hera/H4C/h4c_software/H4C_Notebooks/_rtp_summary_'
# good_statuses = "digital_ok,calibration_maintenance,calibration_triage,calibration_ok"
# os.environ["JULIANDATE"] = JD
# os.environ["DATA_PATH"] = data_path
# os.environ["ANT_METRICS_EXT"] = ant_metrics_ext
# os.environ["REDCAL_EXT"] = redcal_ext
# os.environ["NB_OUTDIR"] = nb_outdir
# os.environ["GOOD_STATUSES"] = good_statuses
In [3]:
# Use environment variables to figure out path to data
JD = os.environ['JULIANDATE']
data_path = os.environ['DATA_PATH']
ant_metrics_ext = os.environ['ANT_METRICS_EXT']
redcal_ext = os.environ['REDCAL_EXT']
nb_outdir = os.environ['NB_OUTDIR']
good_statuses = os.environ['GOOD_STATUSES']
print(f'JD = "{JD}"')
print(f'data_path = "{data_path}"')
print(f'ant_metrics_ext = "{ant_metrics_ext}"')
print(f'redcal_ext = "{redcal_ext}"')
print(f'nb_outdir = "{nb_outdir}"')
print(f'good_statuses = "{good_statuses}"')
JD = "2459977"
data_path = "/mnt/sn1/2459977"
ant_metrics_ext = ".ant_metrics.hdf5"
redcal_ext = ".known_good.omni.calfits"
nb_outdir = "/home/obs/src/H6C_Notebooks/_rtp_summary_"
good_statuses = "digital_ok,calibration_maintenance,calibration_triage,calibration_ok"
In [4]:
from astropy.time import Time, TimeDelta
utc = Time(JD, format='jd').datetime
print(f'Date: {utc.month}-{utc.day}-{utc.year}')
Date: 2-1-2023
In [5]:
# Per-season options
def ant_to_report_url(ant):
    return f'https://htmlpreview.github.io/?https://github.com/HERA-Team/H6C_Notebooks/blob/main/antenna_report/antenna_{ant}_report.html'

Load Auto Metrics¶

In [6]:
use_auto_metrics = False

# find the auto_metrics file
glob_str = os.path.join(data_path, f'zen.{JD}*.auto_metrics.h5')
auto_metrics_file = sorted(glob.glob(glob_str))

# if it exists, load and extract relevant information
if len(auto_metrics_file) > 0:
    auto_metrics_file = auto_metrics_file[0]
    print(f'Found auto_metrics results file at {auto_metrics_file}.')
    
    auto_metrics = load_metric_file(auto_metrics_file)
    mean_round_modz_cut = auto_metrics['parameters']['mean_round_modz_cut']
    auto_ex_ants = auto_metrics['ex_ants']['r2_ex_ants']
    
    use_auto_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping auto_metrics.')
Found auto_metrics results file at /mnt/sn1/2459977/zen.2459977.21340.sum.auto_metrics.h5.

Load Ant Metrics¶

In [7]:
use_ant_metrics = False

# get a list of all ant_metrics files
glob_str = os.path.join(data_path, f'zen.{JD}.?????.sum{ant_metrics_ext}')
ant_metrics_files = sorted(glob.glob(glob_str))

# if they exist, load as many of them as possible
if len(ant_metrics_files) > 0:
    print(f'Found {len(ant_metrics_files)} ant_metrics files matching glob {glob_str}')
    ant_metrics_apriori_exants = {}
    ant_metrics_xants_dict = {}
    ant_metrics_dead_ants_dict = {}
    ant_metrics_crossed_ants_dict = {}
    ant_metrics_dead_metrics = {}
    ant_metrics_crossed_metrics = {}
    dead_cuts = {}
    crossed_cuts = {}
    for amf in ant_metrics_files:
        with h5py.File(amf, "r") as infile: # use h5py directly since it's much faster than load_metric_file
            # get out results for this file
            dead_cuts[amf] = infile['Metrics']['dead_ant_cut'][()]
            crossed_cuts[amf] = infile['Metrics']['cross_pol_cut'][()]
            xants = infile['Metrics']['xants'][:]
            dead_ants = infile['Metrics']['dead_ants'][:]
            crossed_ants = infile['Metrics']['crossed_ants'][:]        
            try:
                # look for ex_ants in history
                ex_ants_string = infile['Header']['history'][()].decode()
                ex_ants_string = ex_ants_string.split('--apriori_xants')[1]
                ex_ants_string = ex_ants_string.split('--')[0].strip()
            except:
                ex_ants_string = ''
                    
            # This only works for the new correlation-matrix-based ant_metrics
            if 'corr' in infile['Metrics']['final_metrics'] and 'corrXPol' in infile['Metrics']['final_metrics']:
                ant_metrics_dead_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corr'][ant][()]
                                                 for ant in infile['Metrics']['final_metrics']['corr']}
                ant_metrics_crossed_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corrXPol'][ant][()]
                                                    for ant in infile['Metrics']['final_metrics']['corrXPol']}                       
            else:
                raise(KeywordError)
        
        # organize results by file
        ant_metrics_xants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in xants]
        ant_metrics_dead_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in dead_ants]
        ant_metrics_crossed_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in crossed_ants]
        ant_metrics_apriori_exants[amf] = [int(ant) for ant in ex_ants_string.split()]
    
    dead_cut = np.median(list(dead_cuts.values()))
    crossed_cut = np.median(list(crossed_cuts.values()))
        
    use_ant_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping ant_metrics.')
Found 1777 ant_metrics files matching glob /mnt/sn1/2459977/zen.2459977.?????.sum.ant_metrics.hdf5

Load chi^2 info from redcal¶

In [8]:
use_redcal = False
glob_str = os.path.join(data_path, f'zen.{JD}.?????.sum{redcal_ext}')

redcal_files = sorted(glob.glob(glob_str))
if len(redcal_files) > 0:
    print(f'Found {len(redcal_files)} ant_metrics files matching glob {glob_str}')
    post_redcal_ant_flags_dict = {}
    flagged_by_redcal_dict = {}
    cspa_med_dict = {}
    for cal in redcal_files:
        hc = io.HERACal(cal)
        _, flags, cspa, chisq = hc.read()
        cspa_med_dict[cal] = {ant: np.nanmedian(cspa[ant], axis=1) for ant in cspa}

        post_redcal_ant_flags_dict[cal] = {ant: np.all(flags[ant]) for ant in flags}
        # check history to distinguish antennas flagged going into redcal from ones flagged during redcal
        tossed_antenna_lines =  hc.history.replace('\n','').split('Throwing out antenna ')[1:]
        flagged_by_redcal_dict[cal] = sorted([int(line.split(' ')[0]) for line in tossed_antenna_lines])
        
    use_redcal = True
else:
    print(f'No files found matching glob {glob_str}. Skipping redcal chisq.')
No files found matching glob /mnt/sn1/2459977/zen.2459977.?????.sum.known_good.omni.calfits. Skipping redcal chisq.

Figure out some general properties¶

In [9]:
# Parse some general array properties, taking into account the fact that we might be missing some of the metrics
ants = []
pols = []
antpol_pairs = []

if use_auto_metrics:
    ants = sorted(set(bl[0] for bl in auto_metrics['modzs']['r2_shape_modzs']))
    pols = sorted(set(bl[2] for bl in auto_metrics['modzs']['r2_shape_modzs']))
if use_ant_metrics:
    antpol_pairs = sorted(set([antpol for dms in ant_metrics_dead_metrics.values() for antpol in dms.keys()]))
    antpols = sorted(set(antpol[1] for antpol in antpol_pairs))
    ants = sorted(set(antpol[0] for antpol in antpol_pairs) | set(ants))
    pols = sorted(set(utils.join_pol(ap, ap) for ap in antpols) | set(pols))
if use_redcal:
    antpol_pairs = sorted(set([ant for cspa in cspa_med_dict.values() for ant in cspa.keys()]) | set(antpol_pairs))
    antpols = sorted(set(antpol[1] for antpol in antpol_pairs))
    ants = sorted(set(antpol[0] for antpol in antpol_pairs) | set(ants))
    pols = sorted(set(utils.join_pol(ap, ap) for ap in antpols) | set(pols))

# Figure out remaining antennas not in data and also LST range
data_files = sorted(glob.glob(os.path.join(data_path, 'zen.*.sum.uvh5')))
hd = io.HERAData(data_files[0])
unused_ants = [ant for ant in hd.antpos if ant not in ants]    
hd_last = io.HERAData(data_files[-1])

Load a priori antenna statuses and node numbers¶

In [10]:
# try to load a priori antenna statusesm but fail gracefully if this doesn't work.
a_priori_statuses = {ant: 'Not Found' for ant in ants}
nodes = {ant: np.nan for ant in ants + unused_ants}
try:
    from hera_mc import cm_hookup

    # get node numbers
    hookup = cm_hookup.get_hookup('default')
    for ant_name in hookup:
        ant = int("".join(filter(str.isdigit, ant_name)))
        if ant in nodes:
            if hookup[ant_name].get_part_from_type('node')['E<ground'] is not None:
                nodes[ant] = int(hookup[ant_name].get_part_from_type('node')['E<ground'][1:])
    
    # get apriori antenna status
    for ant_name, data in hookup.items():
        ant = int("".join(filter(str.isdigit, ant_name)))
        if ant in a_priori_statuses:
            a_priori_statuses[ant] = data.apriori

except Exception as err:
    print(f'Could not load node numbers and a priori antenna statuses.\nEncountered {type(err)} with message: {err}')

Summarize auto metrics¶

In [11]:
if use_auto_metrics:
    # Parse modzs
    modzs_to_check = {'Shape': 'r2_shape_modzs', 'Power': 'r2_power_modzs', 
                      'Temporal Variability': 'r2_temp_var_modzs', 'Temporal Discontinuties': 'r2_temp_diff_modzs'}
    worst_metrics = []
    worst_zs = []
    all_modzs = {}
    binary_flags = {rationale: [] for rationale in modzs_to_check}

    for ant in ants:
        # parse modzs and figure out flag counts
        modzs = {f'{pol} {rationale}': auto_metrics['modzs'][dict_name][(ant, ant, pol)] 
                 for rationale, dict_name in modzs_to_check.items() for pol in pols}
        for pol in pols:
            for rationale, dict_name in modzs_to_check.items():
                binary_flags[rationale].append(auto_metrics['modzs'][dict_name][(ant, ant, pol)] > mean_round_modz_cut)

        # parse out all metrics for dataframe
        for k in modzs:
            col_label = k + ' Modified Z-Score'
            if col_label in all_modzs:
                all_modzs[col_label].append(modzs[k])
            else:
                all_modzs[col_label] = [modzs[k]]
                
    mean_round_modz_cut = auto_metrics['parameters']['mean_round_modz_cut']
else:
    mean_round_modz_cut = 0

Summarize ant metrics¶

In [12]:
if use_ant_metrics:
    a_priori_flag_frac = {ant: np.mean([ant in apxa for apxa in ant_metrics_apriori_exants.values()]) for ant in ants}
    dead_ant_frac = {ap: {ant: np.mean([(ant, ap) in das for das in ant_metrics_dead_ants_dict.values()])
                                 for ant in ants} for ap in antpols}
    crossed_ant_frac = {ant: np.mean([np.any([(ant, ap) in cas for ap in antpols])
                                      for cas in ant_metrics_crossed_ants_dict.values()]) for ant in ants}
    ant_metrics_xants_frac_by_antpol = {antpol: np.mean([antpol in amx for amx in ant_metrics_xants_dict.values()]) for antpol in antpol_pairs}
    ant_metrics_xants_frac_by_ant = {ant: np.mean([np.any([(ant, ap) in amx for ap in antpols])
                                     for amx in ant_metrics_xants_dict.values()]) for ant in ants}
    average_dead_metrics = {ap: {ant: np.nanmean([dm.get((ant, ap), np.nan) for dm in ant_metrics_dead_metrics.values()]) 
                                 for ant in ants} for ap in antpols}
    average_crossed_metrics = {ant: np.nanmean([cm.get((ant, ap), np.nan) for ap in antpols 
                                                for cm in ant_metrics_crossed_metrics.values()]) for ant in ants}
else:
    dead_cut = 0.4
    crossed_cut = 0.0

Summarize redcal chi^2 metrics¶

In [13]:
if use_redcal:
    cspa = {ant: np.nanmedian(np.hstack([cspa_med_dict[cal][ant] for cal in redcal_files])) for ant in antpol_pairs}
    redcal_prior_flag_frac = {ant: np.mean([np.any([afd[ant, ap] and not ant in flagged_by_redcal_dict[cal] for ap in antpols])
                                            for cal, afd in post_redcal_ant_flags_dict.items()]) for ant in ants}
    redcal_flagged_frac = {ant: np.mean([ant in fbr for fbr in flagged_by_redcal_dict.values()]) for ant in ants}

Get FEM switch states¶

In [14]:
HHautos = sorted(glob.glob(f"{data_path}/zen.{JD}.*.sum.autos.uvh5"))
diffautos = sorted(glob.glob(f"{data_path}/zen.{JD}.*.diff.autos.uvh5"))

try:
    db = mc.connect_to_mc_db(None)
    session = db.sessionmaker()
    startJD = float(HHautos[0].split('zen.')[1].split('.sum')[0])
    stopJD = float(HHautos[-1].split('zen.')[1].split('.sum')[0])
    start_time = Time(startJD,format='jd')
    stop_time = Time(stopJD,format='jd')

    # get initial state by looking for commands up to 3 hours before the starttime
    # this logic can be improved after an upcoming hera_mc PR
    # which will return the most recent command before a particular time.
    search_start_time = start_time - TimeDelta(3*3600, format="sec")
    initial_command_res = session.get_array_signal_source(starttime=search_start_time, stoptime=start_time)
    if len(initial_command_res) == 0:
        initial_source = "Unknown"
    elif len(command_res) == 1:
        initial_source = initial_command_res[0].source
    else:
        # multiple commands
        times = []
        sources = []
        for obj in command_res:
            times.append(obj.time)
            sources.append(obj.source)
        initial_source = sources[np.argmax(times)]
    
    # check for any changes during observing
    command_res = session.get_array_signal_source(starttime=start_time, stoptime=stop_time)
    if len(command_res) == 0:
        # still nothing, set it to None
        obs_source = None
    else:
        obs_source_times = []
        obs_source = []
        for obj in command_res:
            obs_source_times.append(obj.time)
            obs_source.append(obj.source)

    if obs_source is not None:
        command_source = [initial_source] + obs_source
    else:
        command_source = initial_source
    
    res = session.get_antenna_status(starttime=startTime, stoptime=stopTime)
    fem_switches = {}
    right_rep_ant = []
    if len(res) > 0:
        for obj in res:
            if obj.antenna_number not in fem_switches.keys():
                fem_switches[obj.antenna_number] = {}
            fem_switches[obj.antenna_number][obj.antenna_feed_pol] = obj.fem_switch
        for ant, pol_dict in fem_switches.items():
            if pol_dict['e'] == initial_source and pol_dict['n'] == initial_source:
                right_rep_ant.append(ant)
except Exception as e:
    print(e)
    initial_source = None
    command_source = None
    right_rep_ant = []
name 'command_res' is not defined

Find X-engine Failures¶

In [15]:
read_inds = [1, len(HHautos)//2, -2]
x_status = [1,1,1,1,1,1,1,1]
s = UVData()
s.read(HHautos[1])

nants = len(s.get_ants())
freqs = s.freq_array[0]*1e-6
nfreqs = len(freqs)

antCon = {a: None for a in ants}
rightAnts = []
for i in read_inds:
    s = UVData()
    d = UVData()
    s.read(HHautos[i])
    d.read(diffautos[i])
    for pol in [0,1]:
        sm = np.abs(s.data_array[:,0,:,pol])
        df = np.abs(d.data_array[:,0,:,pol])
        sm = np.r_[sm, np.nan + np.zeros((-len(sm) % nants,len(freqs)))]
        sm = np.nanmean(sm.reshape(-1,nants,nfreqs),axis=1)
        df = np.r_[df, np.nan + np.zeros((-len(df) % nants,len(freqs)))]
        df = np.nanmean(df.reshape(-1,nants,nfreqs),axis=1)

        evens = (sm + df)/2
        odds = (sm - df)/2
        rat = np.divide(evens,odds)
        rat = np.nan_to_num(rat)
        for xbox in range(0,8):
            xavg = np.nanmean(rat[:,xbox*192:(xbox+1)*192],axis=1)
            if np.nanmax(xavg)>1.5 or np.nanmin(xavg)<0.5:
                x_status[xbox] = 0
    for ant in ants:
        for pol in ["xx", "yy"]:
            if antCon[ant] is False:
                continue
            spectrum = s.get_data(ant, ant, pol)
            stdev = np.std(spectrum)
            med = np.median(np.abs(spectrum))
            if (initial_source == 'digital_noise_same' or initial_source == 'digital_noise_different') and med < 10:
                antCon[ant] = True
            elif (initial_source == "load" or initial_source == 'noise') and 80000 < stdev <= 4000000 and antCon[ant] is not False:
                antCon[ant] = True
            elif initial_source == "antenna" and stdev > 500000 and med > 950000 and antCon[ant] is not False:
                antCon[ant] = True
            else:
                antCon[ant] = False
            if np.min(np.abs(spectrum)) < 100000:
                antCon[ant] = False
for ant in ants:
    if antCon[ant] is True:
        rightAnts.append(ant)
            
x_status_str = ''
for i,x in enumerate(x_status):
    if x==0:
        x_status_str += '\u274C '
    else:
        x_status_str += '\u2705 '

Build Overall Health DataFrame¶

In [16]:
def comma_sep_paragraph(vals, chars_per_line=40):
    outstrs = []
    for val in vals:
        if (len(outstrs) == 0) or (len(outstrs[-1]) > chars_per_line):
            outstrs.append(str(val))
        else:
            outstrs[-1] += ', ' + str(val)
    return ',<br>'.join(outstrs)
In [17]:
# Time data
to_show = {'JD': [JD]}
to_show['Date'] = f'{utc.month}-{utc.day}-{utc.year}'
to_show['LST Range'] = f'{hd.lsts[0] * 12 / np.pi:.3f} -- {hd_last.lsts[-1] * 12 / np.pi:.3f} hours'

# X-engine status
to_show['X-Engine Status'] = x_status_str

# Files
to_show['Number of Files'] = len(data_files)

# Antenna Calculations
to_show['Total Number of Antennas'] = len(ants)

to_show[' '] = ''
to_show['OPERATIONAL STATUS SUMMARY'] = ''

status_count = {status: 0 for status in status_colors}
for ant, status in a_priori_statuses.items():
    if status in status_count:
        status_count[status] = status_count[status] + 1
    else:
        status_count[status] = 1
to_show['Antenna A Priori Status Count'] = '<br>'.join([f'{status}: {status_count[status]}' for status in status_colors if status in status_count and status_count[status] > 0])

to_show['Commanded Signal Source'] = ', '.join(command_source if hasattr(command_source, '__iter__') else [str(command_source)])
to_show['Antennas in Commanded State (reported)'] = f'{len(right_rep_ant)} / {len(ants)} ({len(right_rep_ant) / len(ants):.1%})'
to_show['Antennas in Commanded State (observed)'] = f'{len(rightAnts)} / {len(ants)} ({len(rightAnts) / len(ants):.1%})'

if use_ant_metrics:
    to_show['Cross-Polarized Antennas'] = ', '.join([str(ant) for ant in ants if (np.max([dead_ant_frac[ap][ant] for ap in antpols]) + crossed_ant_frac[ant] == 1) 
                                                                                 and (crossed_ant_frac[ant] > .5)])

# Node calculations
nodes_used = set([nodes[ant] for ant in ants if np.isfinite(nodes[ant])])
to_show['Total Number of Nodes'] = len(nodes_used)
if use_ant_metrics:
    node_off = {node: True for node in nodes_used}
    not_correlating = {node: True for node in nodes_used}
    for ant in ants:
        for ap in antpols:
            if np.isfinite(nodes[ant]):
                if np.isfinite(average_dead_metrics[ap][ant]):
                    node_off[nodes[ant]] = False
                if dead_ant_frac[ap][ant] < 1:
                    not_correlating[nodes[ant]] = False
    to_show['Nodes Registering 0s'] = ', '.join([f'N{n:02}' for n in sorted([node for node in node_off if node_off[node]])])
    to_show['Nodes Not Correlating'] = ', '.join([f'N{n:02}' for n in sorted([node for node in not_correlating if not_correlating[node] and not node_off[node]])])

# Pipeline calculations    
to_show['  '] = ''
to_show['NIGHTLY ANALYSIS SUMMARY'] = ''
    
all_flagged_ants = []
if use_ant_metrics:
    to_show['Ant Metrics Done?'] = '\u2705'
    ant_metrics_flagged_ants = [ant for ant in ants if ant_metrics_xants_frac_by_ant[ant] > 0]
    all_flagged_ants.extend(ant_metrics_flagged_ants)
    to_show['Ant Metrics Flagged Antennas'] = f'{len(ant_metrics_flagged_ants)} / {len(ants)} ({len(ant_metrics_flagged_ants) / len(ants):.1%})' 
else:
    to_show['Ant Metrics Done?'] = '\u274C'
if use_auto_metrics:
    to_show['Auto Metrics Done?'] = '\u2705'
    auto_metrics_flagged_ants = [ant for ant in ants if ant in auto_ex_ants]
    all_flagged_ants.extend(auto_metrics_flagged_ants)    
    to_show['Auto Metrics Flagged Antennas'] = f'{len(auto_metrics_flagged_ants)} / {len(ants)} ({len(auto_metrics_flagged_ants) / len(ants):.1%})' 
else:
    to_show['Auto Metrics Done?'] = '\u274C'
if use_redcal:
    to_show['Redcal Done?'] = '\u2705'    
    redcal_flagged_ants = [ant for ant in ants if redcal_flagged_frac[ant] > 0]
    all_flagged_ants.extend(redcal_flagged_ants)    
    to_show['Redcal Flagged Antennas'] = f'{len(redcal_flagged_ants)} / {len(ants)} ({len(redcal_flagged_ants) / len(ants):.1%})' 
else:
    to_show['Redcal Done?'] = '\u274C' 
to_show['Never Flagged Antennas'] = f'{len(ants) - len(set(all_flagged_ants))} / {len(ants)} ({(len(ants) - len(set(all_flagged_ants))) / len(ants):.1%})'

# Count bad antennas with good statuses and vice versa
n_apriori_good = len([ant for ant in ants if a_priori_statuses[ant] in good_statuses.split(',')])
apriori_good_flagged = []
aprior_bad_unflagged = []
for ant in ants:
    if ant in set(all_flagged_ants) and a_priori_statuses[ant] in good_statuses.split(','):
        apriori_good_flagged.append(ant)
    elif ant not in set(all_flagged_ants) and a_priori_statuses[ant] not in good_statuses.split(','):
        aprior_bad_unflagged.append(ant)
to_show['A Priori Good Antennas Flagged'] = f'{len(apriori_good_flagged)} / {n_apriori_good} total a priori good antennas:<br>' + \
                                            comma_sep_paragraph(apriori_good_flagged)
to_show['A Priori Bad Antennas Not Flagged'] = f'{len(aprior_bad_unflagged)} / {len(ants) - n_apriori_good} total a priori bad antennas:<br>' + \
                                            comma_sep_paragraph(aprior_bad_unflagged)

# Apply Styling
df = pd.DataFrame(to_show)
divider_cols = [df.columns.get_loc(col) for col in ['NIGHTLY ANALYSIS SUMMARY', 'OPERATIONAL STATUS SUMMARY']]
try:
    to_red_columns = [df.columns.get_loc(col) for col in ['Cross-Polarized Antennas', 'Nodes Registering 0s', 
                                                          'Nodes Not Correlating', 'A Priori Good Antennas Flagged']]
except:
    to_red_columns = []
def red_specific_cells(x):
    df1 = pd.DataFrame('', index=x.index, columns=x.columns)
    for col in to_red_columns:
        df1.iloc[col] = 'color: red'
    return df1

df = df.T
table = df.style.hide_columns().apply(red_specific_cells, axis=None)
for col in divider_cols:
    table = table.set_table_styles([{"selector":f"tr:nth-child({col+1})", "props": [("background-color", "black"), ("color", "white")]}], overwrite=False)

Table 1: Overall Array Health¶

In [18]:
HTML(table.render())
Out[18]:
JD 2459977
Date 2-1-2023
LST Range 3.325 -- 13.275 hours
X-Engine Status ✅ ✅ ❌ ✅ ✅ ❌ ✅ ✅
Number of Files 1777
Total Number of Antennas 196
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 9
dish_ok: 1
RF_maintenance: 50
RF_ok: 19
digital_ok: 93
not_connected: 24
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 196 (0.0%)
Antennas in Commanded State (observed) 0 / 196 (0.0%)
Cross-Polarized Antennas 96
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 110 / 196 (56.1%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 112 / 196 (57.1%)
Redcal Done? ❌
Never Flagged Antennas 62 / 196 (31.6%)
A Priori Good Antennas Flagged 57 / 93 total a priori good antennas:
3, 5, 7, 9, 10, 15, 16, 29, 30, 40, 42, 53,
54, 55, 56, 65, 66, 67, 70, 71, 72, 81, 83,
86, 88, 94, 101, 103, 107, 109, 111, 121, 122,
123, 128, 136, 143, 144, 150, 151, 158, 161,
162, 165, 167, 170, 171, 173, 182, 185, 186,
187, 189, 191, 192, 193, 202
A Priori Bad Antennas Not Flagged 26 / 103 total a priori bad antennas:
22, 35, 43, 46, 48, 61, 62, 64, 73, 89, 95,
115, 125, 132, 133, 137, 139, 211, 223, 237,
238, 239, 240, 241, 245, 261
In [19]:
# write to csv
outpath = os.path.join(nb_outdir, f'array_health_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.replace({'\u2705': 'Y'}, regex=True).replace({'\u274C': 'N'}, regex=True).replace({'<br>': ' '}, regex=True).to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/array_health_table_2459977.csv

Build DataFrame¶

In [20]:
# build dataframe
to_show = {'Ant': [f'<a href="{ant_to_report_url(ant)}" target="_blank">{ant}</a>' for ant in ants],
           'Node': [f'N{nodes[ant]:02}' for ant in ants], 
           'A Priori Status': [a_priori_statuses[ant] for ant in ants]}
           #'Worst Metric': worst_metrics, 'Worst Modified Z-Score': worst_zs}
df = pd.DataFrame(to_show)

# create bar chart columns for flagging percentages:
bar_cols = {}
if use_auto_metrics:
    bar_cols['Auto Metrics Flags'] = [float(ant in auto_ex_ants) for ant in ants]
if use_ant_metrics:
    if np.sum(list(a_priori_flag_frac.values())) > 0:  # only include this col if there are any a priori flags
        bar_cols['A Priori Flag Fraction in Ant Metrics'] = [a_priori_flag_frac[ant] for ant in ants]
    for ap in antpols:
        bar_cols[f'Dead Fraction in Ant Metrics ({ap})'] = [dead_ant_frac[ap][ant] for ant in ants]
    bar_cols['Crossed Fraction in Ant Metrics'] = [crossed_ant_frac[ant] for ant in ants]
if use_redcal:
    bar_cols['Flag Fraction Before Redcal'] = [redcal_prior_flag_frac[ant] for ant in ants]
    bar_cols['Flagged By Redcal chi^2 Fraction'] = [redcal_flagged_frac[ant] for ant in ants]  
for col in bar_cols:
    df[col] = bar_cols[col]

# add auto_metrics
if use_auto_metrics:
    for label, modz in all_modzs.items():
        df[label] = modz
z_score_cols = [col for col in df.columns if 'Modified Z-Score' in col]        
        
# add ant_metrics
ant_metrics_cols = {}
if use_ant_metrics:
    for ap in antpols:
        ant_metrics_cols[f'Average Dead Ant Metric ({ap})'] = [average_dead_metrics[ap][ant] for ant in ants]
    ant_metrics_cols['Average Crossed Ant Metric'] = [average_crossed_metrics[ant] for ant in ants]
    for col in ant_metrics_cols:
        df[col] = ant_metrics_cols[col]   

# add redcal chisq
redcal_cols = []
if use_redcal:
    for ap in antpols:
        col_title = f'Median chi^2 Per Antenna ({ap})'
        df[col_title] = [cspa[ant, ap] for ant in ants]
        redcal_cols.append(col_title)

# sort by node number and then by antenna number within nodes
df.sort_values(['Node', 'Ant'], ascending=True)

# style dataframe
table = df.style.hide_index()\
          .applymap(lambda val: f'background-color: {status_colors[val]}' if val in status_colors else '', subset=['A Priori Status']) \
          .background_gradient(cmap='viridis', vmax=mean_round_modz_cut * 3, vmin=0, axis=None, subset=z_score_cols) \
          .background_gradient(cmap='bwr_r', vmin=dead_cut-.25, vmax=dead_cut+.25, axis=0, subset=list([col for col in ant_metrics_cols if 'dead' in col.lower()])) \
          .background_gradient(cmap='bwr_r', vmin=crossed_cut-.25, vmax=crossed_cut+.25, axis=0, subset=list([col for col in ant_metrics_cols if 'crossed' in col.lower()])) \
          .background_gradient(cmap='plasma', vmax=4, vmin=1, axis=None, subset=redcal_cols) \
          .applymap(lambda val: 'font-weight: bold' if val < dead_cut else '', subset=list([col for col in ant_metrics_cols if 'dead' in col.lower()])) \
          .applymap(lambda val: 'font-weight: bold' if val < crossed_cut else '', subset=list([col for col in ant_metrics_cols if 'crossed' in col.lower()])) \
          .applymap(lambda val: 'font-weight: bold' if val > mean_round_modz_cut else '', subset=z_score_cols) \
          .applymap(lambda val: 'color: red' if val > mean_round_modz_cut else '', subset=z_score_cols) \
          .bar(subset=list(bar_cols.keys()), vmin=0, vmax=1) \
          .format({col: '{:,.4f}'.format for col in z_score_cols}) \
          .format({col: '{:,.4f}'.format for col in ant_metrics_cols}) \
          .format({col: '{:,.2%}'.format for col in bar_cols}) \
          .applymap(lambda val: 'font-weight: bold', subset=['Ant']) \
          .set_table_styles([dict(selector="th",props=[('max-width', f'70pt')])])

Table 2: RTP Per-Antenna Metrics Summary Table¶

This admittedly very busy table incorporates summary information about all antennas in the array. Its columns depend on what information is available when the notebook is run (i.e. whether auto_metrics, ant_metrics, and/or redcal is done). These can be divided into 5 sections:

Basic Antenna Info: antenna number, node, and its a priori status.

Flag Fractions: Fraction of the night that an antenna was flagged for various reasons. Note that auto_metrics flags antennas for the whole night, so it'll be 0% or 100%.

auto_metrics Details: If auto_metrics is included, this section shows the modified Z-score signifying how much of an outlier each antenna and polarization is in each of four categories: bandpass shape, overall power, temporal variability, and temporal discontinuities. Bold red text indicates that this is a reason for flagging the antenna. It is reproduced from the auto_metrics_inspect.ipynb nightly notebook, so check that out for more details on the precise metrics.

ant_metrics Details: If ant_metrics is included, this section shows the average correlation-based metrics for antennas over the whole night. Low "dead ant" metrics (nominally below 0.4) indicate antennas not correlating with the rest of the array. Negative "crossed ant" metrics indicate antennas that show stronger correlations in their cross-pols than their same-pols, indicating that the two polarizations are probably swapped. Bold text indicates that the average is below the threshold for flagging.

redcal chi^2 Details: If redcal is included, this shows the median chi^2 per antenna. This would be 1 in an ideal array. Antennas are thrown out when they they are outliers in their median chi^2, usually greater than 4-sigma outliers in modified Z-score.

In [21]:
HTML(table.render())
Out[21]:
Ant Node A Priori Status Auto Metrics Flags Dead Fraction in Ant Metrics (Jee) Dead Fraction in Ant Metrics (Jnn) Crossed Fraction in Ant Metrics ee Shape Modified Z-Score nn Shape Modified Z-Score ee Power Modified Z-Score nn Power Modified Z-Score ee Temporal Variability Modified Z-Score nn Temporal Variability Modified Z-Score ee Temporal Discontinuties Modified Z-Score nn Temporal Discontinuties Modified Z-Score Average Dead Ant Metric (Jee) Average Dead Ant Metric (Jnn) Average Crossed Ant Metric
3 N01 digital_ok 100.00% 100.00% 22.17% 0.00% 10.427572 13.381530 9.578761 -0.314244 11.038716 5.431122 0.224337 4.869497 0.029484 0.244892 0.189519
4 N01 RF_maintenance 100.00% 20.32% 18.91% 0.00% 0.304656 1.378237 1.913409 0.041599 4.321561 1.281496 4.734945 -0.079092 0.444536 0.472252 0.304222
5 N01 digital_ok 0.00% 20.60% 19.08% 0.00% -0.827800 -0.206668 0.432264 0.112912 0.293211 2.504740 -0.337656 -0.592936 0.457178 0.474455 0.296359
7 N02 digital_ok 100.00% 22.17% 20.20% 0.00% -0.938915 0.306146 -1.189017 -0.145091 0.236718 0.477398 10.217033 10.427992 0.456885 0.473341 0.283829
8 N02 RF_maintenance 0.00% 22.17% 20.43% 0.00% -0.106282 -1.290426 -0.651746 -0.018409 -0.054964 1.068303 2.166025 0.493990 0.456622 0.471018 0.278494
9 N02 digital_ok 100.00% 22.17% 20.43% 0.00% 4.723767 -0.164439 7.939415 -0.455852 6.432129 0.100567 0.001707 -0.430149 0.317932 0.468126 0.329836
10 N02 digital_ok 100.00% 10.35% 0.00% 0.00% 4.350266 -0.702326 7.371581 -1.455782 5.386285 1.775357 0.239626 0.463860 0.376962 0.534340 0.380491
15 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 10.639051 13.232114 8.996603 9.698814 11.053328 12.749349 0.292374 0.706246 0.025535 0.024456 0.001475
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.649380 -0.833972 9.544516 0.706520 11.048987 2.332697 0.650465 2.246466 0.030255 0.540866 0.427982
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.746115 1.624605 0.309613 0.309582 0.848700 1.119209 1.120623 0.992720 0.525800 0.546093 0.348885
18 N01 RF_maintenance 100.00% 100.00% 64.04% 0.00% 11.271755 18.048030 9.518500 -0.646022 11.229067 7.436364 0.152819 16.143282 0.027487 0.175527 0.131539
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.610755 -0.496421 -1.235268 -0.905527 -0.295884 1.610475 0.476513 0.845742 0.529752 0.552496 0.338778
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.877219 -1.116122 2.310293 -1.139182 0.401607 1.397009 1.320588 -0.402616 0.516838 0.551309 0.341078
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.194700 0.591421 -0.742954 -0.040102 0.662034 2.139259 -0.020441 -0.067957 0.525848 0.535809 0.335001
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.530665 -0.213329 0.335869 0.008533 0.984462 0.921072 -0.251836 -1.030718 0.508615 0.527733 0.340926
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.971324 12.547563 9.577507 10.101143 11.196769 12.831405 1.615657 1.365244 0.031505 0.034402 0.003920
28 N01 RF_maintenance 100.00% 20.15% 94.77% 0.00% 11.233093 25.282438 -0.354924 2.504844 7.618130 10.752623 4.957830 19.265767 0.287571 0.123893 0.205509
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 205.376472 206.282110 inf inf 3102.178063 3114.325261 5927.502962 5661.505985 nan nan nan
30 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 166.719929 167.013249 inf inf 3612.081329 3595.863157 6022.062126 5959.124208 nan nan nan
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.592712 -1.233441 1.004008 0.964802 1.967465 -0.709453 0.195156 2.227998 0.550601 0.560221 0.341741
32 N02 RF_maintenance 100.00% 0.00% 1.41% 0.00% -0.404926 26.504969 -0.230436 2.766052 0.024716 0.566101 1.314411 6.020651 0.541891 0.448794 0.323878
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 12.210052 14.220011 4.170397 4.578280 11.200420 12.808280 1.836219 1.549804 0.032189 0.042564 0.007297
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.782120 -0.322633 1.244076 -1.357301 0.803009 -1.251430 -1.527004 -0.656592 0.521259 0.516430 0.334629
36 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 26.503100 27.123777 12.715696 12.762023 11.303305 12.687142 4.460000 4.496272 0.030682 0.028723 0.001318
37 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.470168 0.618664 -1.271918 1.343155 1.345704 1.740950 -0.259791 3.044257 0.531824 0.545303 0.358939
38 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.024077 -0.337631 0.092607 0.494374 -0.107384 1.416333 3.718962 0.496676 0.538668 0.554177 0.359527
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 10.060542 4.082010 9.206444 0.374190 11.159306 0.024787 1.230001 0.845599 0.035186 0.531646 0.393671
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.680982 0.149157 -0.187515 -0.008324 2.552135 0.556194 -0.005080 2.500730 0.531368 0.555098 0.336078
42 N04 digital_ok 100.00% 0.00% 0.00% 0.00% -0.613414 -0.267677 4.554422 5.743040 -0.360187 -0.076235 0.581725 0.475071 0.514083 0.525767 0.324365
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.024589 0.631642 -0.182093 0.578406 -0.670716 0.472852 -0.707833 1.204743 0.567104 0.572396 0.352476
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.961984 0.197746 -0.650835 -0.576044 -0.302781 0.481195 -0.430682 0.016201 0.559886 0.581124 0.351732
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.547360 3.667108 0.086834 0.534349 -0.688768 2.114421 0.194313 2.185410 0.544250 0.558366 0.337596
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.209536 0.113456 -0.899827 -1.191093 -0.368470 -0.176720 -0.635299 -1.069960 0.550751 0.576303 0.357771
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 11.314962 13.898481 3.999360 4.218601 11.179367 12.774924 3.286669 2.533306 0.027999 0.044884 0.011949
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.026354 1.057102 0.366458 1.602118 -0.564142 2.624229 -1.229911 -2.439581 0.525062 0.547978 0.348945
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% 0.221952 -0.469762 -0.401841 -1.019311 1.575512 -0.652273 2.212653 14.286007 0.473905 0.519813 0.340881
50 N03 RF_maintenance 100.00% 16.49% 15.59% 0.00% 12.046365 2.078857 0.630953 0.879173 1.249192 1.241080 20.783670 6.084645 0.435863 0.472289 0.288217
51 N03 dish_maintenance 100.00% 100.00% 0.39% 0.00% 23.308338 4.374005 12.203217 -0.561835 11.349933 5.020657 8.532444 2.034522 0.036939 0.437082 0.320748
52 N03 RF_maintenance 100.00% 14.41% 14.41% 0.00% 7.945325 6.554010 -0.485398 0.463390 1.562323 0.937595 1.857638 1.040002 0.487126 0.501396 0.306952
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 1.162356 3.218398 0.004017 0.280087 1.679229 2.364903 2.404629 4.027978 0.553271 0.569833 0.356862
54 N04 digital_ok 100.00% 12.49% 0.00% 0.00% 27.755343 -0.853596 4.906134 3.019631 2.756203 -0.968372 3.209617 0.893466 0.362112 0.550802 0.335199
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.909492 13.863997 9.598107 10.221159 11.202823 12.804047 1.876320 3.432348 0.025729 0.029304 0.003406
56 N04 digital_ok 100.00% 0.00% 2.14% 0.00% -0.152358 2.019328 5.371397 7.351527 1.408761 3.242694 0.134227 1.274282 0.498648 0.478485 0.303858
57 N04 RF_maintenance 100.00% 12.94% 0.00% 0.00% 15.489335 0.279199 7.293107 1.084769 5.221798 1.964942 42.702227 5.700908 0.376758 0.561509 0.368924
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.046307 12.921741 9.484649 10.222524 11.112210 12.773127 3.150240 2.979567 0.033821 0.033325 0.001353
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.896225 0.740280 9.051670 0.877890 10.872328 1.969608 0.822717 6.677764 0.043255 0.569216 0.435592
60 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 2.231768 12.816243 -0.519867 10.248430 -0.015882 12.785616 1.835696 3.651680 0.553161 0.058960 0.435219
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.427984 0.119753 -0.760113 -1.464601 1.888476 -1.223024 -0.154133 0.469385 0.501287 0.536587 0.338815
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.746379 0.696111 -0.773924 0.928807 -0.005898 -0.133913 2.480326 -0.815306 0.488102 0.546360 0.352061
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 0.091505 13.372087 -0.393421 4.603954 1.160084 12.888267 0.528368 2.904637 0.524326 0.041206 0.406633
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.087304 0.243841 -0.807104 -0.981800 -0.550671 -0.834621 0.565685 0.312684 0.508102 0.500131 0.325291
65 N03 digital_ok 0.00% 16.99% 16.38% 0.00% 0.509302 1.347799 0.333650 1.019130 -0.020685 1.158038 -0.109271 -0.673336 0.461708 0.479919 0.308751
66 N03 digital_ok 0.00% 16.83% 16.26% 0.00% 0.842058 1.542037 -1.438468 -1.235091 3.199841 -0.471284 -1.033463 -0.657525 0.476410 0.495725 0.309866
67 N03 digital_ok 0.00% 16.32% 16.26% 0.00% -0.552489 2.108266 -0.939277 0.585251 -0.411315 0.414064 -0.487677 2.056783 0.487033 0.489738 0.297499
68 N03 dish_maintenance 100.00% 18.80% 100.00% 0.00% 20.239393 27.243944 0.961560 13.444131 5.758058 12.686286 -0.244634 8.481378 0.302473 0.028246 0.225148
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.835138 -0.092434 0.187425 0.741768 -0.087173 1.284443 0.155495 0.213903 0.540222 0.566421 0.335961
70 N04 digital_ok 0.00% 19.30% 18.40% 0.00% 0.638056 -0.229564 -0.263034 0.039840 1.200745 1.619913 0.380865 0.152391 0.494152 0.512981 0.291316
71 N04 digital_ok 100.00% 18.91% 18.35% 0.00% 7.832328 -0.239836 0.527712 0.915435 0.799692 -0.177164 1.744511 1.685570 0.501987 0.517170 0.288934
72 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.626200 14.097814 9.950452 10.615743 10.859802 12.533399 1.216665 1.600577 0.028922 0.032532 0.003813
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.655974 1.006578 -1.447669 -1.075284 1.227660 -0.056013 -0.129038 -0.283603 0.569826 0.586860 0.346493
74 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.102052 0.192263 -0.188726 -0.567766 0.618747 1.251020 -0.013318 4.367467 0.576114 0.588630 0.351329
77 N06 not_connected 100.00% 19.81% 0.00% 0.00% 51.699994 0.930096 0.392170 -0.565352 5.735072 -0.848546 11.717276 -0.512973 0.289011 0.540379 0.368510
78 N06 not_connected 100.00% 4.45% 0.00% 0.00% 33.724197 -0.140773 -0.526684 0.866279 3.172768 0.372195 3.070592 2.304886 0.363703 0.553111 0.345578
79 N11 not_connected 100.00% 0.00% 100.00% 0.00% 1.781095 13.659753 -1.521437 4.625687 -0.230443 12.651747 1.190325 -0.117760 0.503635 0.036779 0.377888
80 N11 not_connected 100.00% 16.71% 100.00% 0.00% -0.532390 14.488710 0.207192 4.528947 -0.486088 12.719344 -0.225605 1.124260 0.460364 0.044154 0.352005
81 N07 digital_ok 100.00% 11.14% 100.00% 0.00% -0.210189 13.801103 0.010694 8.902361 -0.271213 12.361735 -0.291928 1.156994 0.459772 0.035440 0.347931
82 N07 RF_maintenance 0.00% 10.52% 11.03% 0.00% 2.998447 -0.174434 0.314785 2.040769 -0.174185 -0.208707 0.005080 1.161041 0.478774 0.487758 0.306093
83 N07 digital_ok 0.00% 10.30% 10.30% 0.00% -0.384236 0.109208 0.100715 0.357615 0.473133 0.283259 -1.024548 -0.098931 0.491832 0.510657 0.312709
84 N08 RF_maintenance 100.00% 90.38% 100.00% 0.00% 20.005898 24.369663 12.345584 13.007551 9.451308 12.674926 3.355971 4.073457 0.154889 0.033948 0.095141
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.097817 0.675622 0.678581 0.693652 -0.721260 0.671632 -0.131497 0.119604 0.540436 0.561143 0.335327
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.292145 -0.225534 0.667845 0.908527 4.347157 -0.577395 0.143950 17.228850 0.532502 0.558290 0.322805
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.332204 4.706740 -1.011390 -0.689900 3.808280 2.849038 60.959662 57.923018 0.555978 0.580276 0.318007
88 N09 digital_ok 0.00% 19.81% 18.80% 0.00% 0.769386 0.342219 0.292096 0.725678 -0.081996 -0.437195 1.297698 0.285575 0.491875 0.510001 0.281668
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.599951 0.424135 -0.020881 0.797303 -0.222933 -0.613827 -0.667981 -0.526081 0.562030 0.576431 0.334659
90 N09 RF_maintenance 0.00% 19.92% 18.91% 0.00% -0.037478 -0.636403 0.763531 3.214475 -0.860733 -0.279952 -0.411599 2.083280 0.487459 0.485378 0.277234
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.100779 0.008877 0.334253 0.237593 -0.321312 -0.750715 0.103006 -0.067103 0.547939 0.569159 0.343148
92 N10 RF_maintenance 100.00% 22.12% 35.79% 0.00% 35.199466 37.837671 0.344186 1.397405 7.137755 5.148031 9.003562 8.006592 0.237387 0.205343 0.052420
93 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 1.887798 -0.278499 2.124411 -1.121909 1.143174 0.404577 2.729812 -0.371012 0.533767 0.558472 0.344436
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.449689 13.350747 9.695078 10.118733 10.945524 12.721183 0.814773 0.596248 0.030716 0.025119 0.002877
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.766355 -0.102302 -0.997849 0.650596 -0.632726 0.143568 0.272712 0.491965 0.516007 0.544850 0.349164
96 N11 not_connected 100.00% 21.22% 21.22% 78.78% 12.044517 7.097936 3.184108 4.458825 4.528450 10.078792 -2.890975 -4.216187 0.206174 0.171701 -0.198814
97 N11 not_connected 100.00% 0.00% 2.36% 0.00% -0.912436 5.895324 -1.247129 1.334875 -0.222262 4.145172 1.807011 6.785781 0.493647 0.444688 0.323343
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.479419 8.825455 -0.469174 1.110202 0.072245 1.981537 0.182203 0.257652 0.554915 0.570070 0.345545
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.641296 1.134276 -0.941417 -1.492703 0.550569 1.196703 -0.272482 6.941721 0.556025 0.571790 0.337318
103 N08 digital_ok 100.00% 16.99% 16.04% 0.00% 2.389825 5.478428 2.719432 -1.271433 8.924913 2.081329 8.763223 7.418277 0.490492 0.521600 0.294345
104 N08 RF_maintenance 100.00% 16.15% 16.88% 0.00% 9.029821 60.748924 -0.881903 6.868380 2.038990 -0.217685 0.457755 2.727252 0.507641 0.497404 0.287545
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.211523 -0.127477 0.166668 0.833644 0.365741 -0.694893 -0.787866 -0.311546 0.559549 0.574486 0.331186
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.706138 1.517128 -1.415783 -0.549666 0.940702 -0.714996 0.247162 0.339166 0.560832 0.577249 0.330837
107 N09 digital_ok 100.00% 19.81% 18.74% 0.00% 1.850030 1.289588 -0.811806 -1.070175 0.192422 -0.037788 5.339878 4.702255 0.495533 0.514703 0.283926
108 N09 RF_maintenance 100.00% 100.00% 22.06% 0.00% 10.487833 42.962394 9.521576 0.940733 11.151374 5.798254 1.454182 13.246899 0.033025 0.233296 0.127813
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 10.346074 12.919271 9.553305 9.980785 11.227139 12.805104 0.571794 1.799885 0.026205 0.024257 0.001788
110 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 25.612315 25.872263 12.783363 13.208715 11.050580 12.491905 4.108456 4.380485 0.022237 0.023552 0.001044
111 N10 digital_ok 100.00% 22.17% 100.00% 0.00% 31.359318 13.072871 1.041958 9.923087 5.766797 12.387953 2.029109 1.249992 0.236477 0.069780 0.128319
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.484126 -0.329411 0.132536 0.171888 1.233647 3.658321 0.696318 -0.563405 0.537128 0.550115 0.346229
113 N11 not_connected 100.00% 0.00% 100.00% 0.00% 4.591492 14.225448 3.491309 4.609838 4.774788 12.581556 -2.746122 0.932521 0.530226 0.061501 0.399398
114 N11 not_connected 100.00% 100.00% 100.00% 0.00% 16.345136 12.572416 17.920358 11.289302 37.844186 16.142276 687.294796 117.057541 0.018732 0.025612 0.004138
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.859715 -0.693154 -1.152721 -0.686400 0.078278 -1.356441 -0.959699 -0.832956 0.482707 0.512573 0.339706
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.371785 14.391119 9.652576 10.573909 10.984557 12.726918 1.259492 3.607335 0.025760 0.030421 0.003255
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.008877 1.581251 -0.257861 0.496693 0.005898 0.234786 0.731159 1.622519 0.531899 0.556183 0.353716
120 N08 RF_maintenance 100.00% 16.88% 16.04% 0.00% 4.254009 2.266993 2.570027 -0.950936 -0.587103 1.240728 0.584380 -0.534016 0.484755 0.517586 0.300230
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.230537 2.953973 -1.390618 5.782416 1.004431 -0.363519 5.530534 16.493394 0.565499 0.554444 0.330556
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.716764 6.664293 0.031854 0.842832 1.014181 1.329274 -0.798034 -1.116396 0.560689 0.588013 0.342980
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.326897 9.295286 0.661579 0.945876 0.341839 0.124237 0.098948 0.807305 0.578816 0.594837 0.347351
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.229444 0.043131 -0.087434 0.580610 -0.216187 0.371567 0.421367 0.043111 0.570986 0.587923 0.343840
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.667386 0.267077 -0.408937 0.746929 -0.130660 -0.442691 0.732305 0.042395 0.561475 0.572330 0.335608
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.777902 2.766871 -1.126700 1.238325 7.526842 0.900026 22.895877 3.554501 0.542734 0.564925 0.338320
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 2.652609 0.499765 0.418865 0.338395 1.689336 0.639204 -0.383462 0.150276 0.554155 0.575147 0.345146
128 N10 digital_ok 100.00% 1.63% 100.00% 0.00% 1.285453 12.450868 6.929377 10.223202 1.738223 12.630596 -0.663856 0.858533 0.449590 0.031641 0.313528
131 N11 not_connected 100.00% 0.00% 23.19% 0.00% -0.841550 12.654568 -0.130703 4.456379 -0.604758 11.135299 -0.956166 0.219214 0.533255 0.225413 0.372823
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.475859 2.776771 -0.377057 -1.520080 1.106591 -0.649993 0.010962 -0.129266 0.507138 0.506915 0.325142
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.008159 0.600371 -0.954264 1.610907 -0.935342 1.347052 -0.976607 -1.040870 0.496737 0.533144 0.355637
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.087232 -1.103603 -1.084828 -1.613978 3.383971 0.812550 7.288675 0.239852 0.500413 0.540617 0.366542
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 9.667198 0.057874 9.151816 -0.798720 11.189465 0.381539 0.968933 -0.089318 0.038372 0.541215 0.395427
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.113695 -0.673360 0.069663 -1.560444 1.753950 -0.577145 0.479542 0.986066 0.511858 0.551857 0.354848
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.056662 -0.068556 1.376559 -1.058171 1.126401 -1.177332 -1.360260 -0.205574 0.542185 0.551113 0.337597
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.567366 -0.820387 -1.041126 -0.385291 -0.654915 -0.643402 3.249098 2.834875 0.561585 0.584517 0.346116
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.261965 -0.781243 -0.346217 0.466220 1.489176 -0.749441 0.853757 -0.912405 0.563575 0.590479 0.344828
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.635423 12.866746 -0.723835 10.250730 3.045660 12.805717 24.975314 1.594219 0.560648 0.042894 0.448169
143 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -1.286428 -0.171487 -0.822760 1.013513 -0.168173 5.045046 -0.446627 -1.178612 0.558864 0.571414 0.333587
144 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.058969 -0.717892 -1.247446 4.802172 0.228983 17.445165 -0.769508 -0.605193 0.569269 0.533561 0.343110
145 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.787302 13.062895 9.539069 10.289557 10.908178 12.869884 0.694511 3.129123 0.063000 0.029908 0.025474
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.141591 -0.551582 1.346427 0.407821 1.293178 -0.083599 -1.714713 -1.720902 0.555867 0.571137 0.339357
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.575747 -1.584646 1.009933 2.270110 -0.468137 -0.686906 -0.119370 0.332734 0.553767 0.562324 0.338881
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.167142 0.154637 -0.673137 -0.598727 1.967359 2.071312 -1.192957 -1.150573 0.556395 0.574640 0.352162
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.059429 -1.162113 -1.214159 -1.505242 -0.134135 1.522557 0.815806 0.758110 0.549919 0.567975 0.354687
150 N15 digital_ok 0.00% 20.65% 18.96% 0.00% -0.438259 -0.510333 -1.264909 -1.408481 -0.704115 0.816326 0.680943 1.175395 0.478401 0.492068 0.300521
151 N16 digital_ok 100.00% 3.38% 0.56% 0.00% 22.737140 1.241177 -0.181258 0.392271 4.855257 -0.907637 4.903293 -0.600572 0.409516 0.487254 0.301115
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 9.983646 -0.852746 9.303235 -1.384158 11.228427 0.443362 1.175088 0.369321 0.039517 0.544082 0.405775
156 N12 RF_maintenance 100.00% 7.54% 100.00% 0.00% 3.872130 12.614529 7.747999 9.994347 6.056981 12.829750 0.707200 1.507171 0.353132 0.036836 0.264728
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.062706 -0.244784 -0.105245 0.662318 -0.214605 1.024604 -0.608681 -0.428594 0.526392 0.555434 0.357799
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.223502 0.153405 -0.228219 -0.536173 2.048849 2.599391 2.861544 14.885078 0.542422 0.571826 0.359768
159 N13 RF_maintenance 100.00% 0.00% 4.39% 0.00% 0.513176 28.787109 -1.570353 -0.762475 0.070666 5.035421 -0.864513 21.148987 0.507760 0.421916 0.306079
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.571045 -0.896786 -0.368644 -0.697517 -0.394441 2.005491 0.491721 0.381426 0.551552 0.571867 0.344758
161 N13 digital_ok 100.00% 10.69% 17.28% 0.00% -0.955428 29.815625 -0.081005 -0.537227 0.520207 1.911672 0.743630 1.966434 0.505931 0.404851 0.273208
162 N13 digital_ok 0.00% 10.75% 11.42% 0.00% 2.518171 -0.834902 -0.898354 -1.359643 1.362749 1.202532 2.872863 -0.250944 0.507625 0.531150 0.305097
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.573844 1.174840 -0.296023 0.415502 -0.172877 1.032596 -0.129015 1.208813 0.551636 0.566033 0.335380
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.960657 0.431901 0.345207 1.375128 -0.101836 2.123073 0.675645 0.685679 0.546836 0.560639 0.328082
165 N14 digital_ok 100.00% 3.04% 0.00% 0.00% 32.955393 -0.065608 -0.552337 -0.983663 4.509843 -0.053213 2.046248 -0.327918 0.424487 0.574446 0.333739
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.280046 3.195340 -0.504586 2.900522 0.256699 5.280274 3.265801 0.242201 0.552489 0.561788 0.335544
167 N15 digital_ok 0.00% 19.47% 18.46% 0.00% -0.898967 -0.984658 -1.453948 -0.092560 1.681480 0.019304 -0.168270 2.461847 0.492179 0.502349 0.290646
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.968394 -1.168786 0.178153 -0.375530 1.340326 0.820971 -0.802473 0.162763 0.539864 0.556526 0.340569
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.782717 -0.993243 -0.961606 -1.581125 0.715367 0.711287 -0.755760 -0.810811 0.539597 0.557693 0.344082
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 11.309743 -0.420275 9.850462 -0.701300 10.944164 0.732250 2.223129 6.958877 0.038066 0.551022 0.417835
171 N16 digital_ok 0.00% 0.00% 1.01% 0.00% 0.889830 2.818581 -1.240994 0.699823 -0.499370 2.131798 -0.132923 1.083024 0.486473 0.468670 0.312402
173 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 12.661989 13.483348 3.540070 4.232610 11.269471 12.830086 2.315128 4.005224 0.035887 0.040580 0.004068
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.137488 -0.450700 -0.146141 -0.919841 0.353609 9.483483 -0.458101 3.366038 0.514100 0.567550 0.359989
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.395019 13.560149 -1.602216 10.391986 1.152731 12.674364 15.929630 1.965236 0.551627 0.048917 0.446545
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.584035 -0.101856 0.372855 0.451178 0.222870 -0.124183 -0.611356 3.760936 0.555459 0.570575 0.350018
182 N13 digital_ok 100.00% 10.64% 100.00% 0.00% 0.348766 12.556129 -1.157229 9.963878 0.214800 12.873127 6.705253 1.687051 0.511819 0.043061 0.385054
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.575043 0.188926 -0.830622 0.050393 1.483816 -0.625433 1.105506 0.079901 0.558291 0.573932 0.341250
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.007471 -0.529904 -1.584677 -0.391529 -0.589262 -0.273505 -0.567363 -0.373534 0.557310 0.573603 0.331542
185 N14 digital_ok 100.00% 21.22% 16.99% 0.00% 34.754153 -0.184554 -0.519052 -1.456412 11.412427 1.238651 8.505533 0.125331 0.392243 0.514238 0.291624
186 N14 digital_ok 0.00% 17.28% 16.94% 0.00% -1.017951 -0.692761 0.325630 -0.398552 -0.165578 -0.938601 -0.476585 0.391950 0.502877 0.517769 0.295851
187 N14 digital_ok 0.00% 17.78% 17.05% 0.00% 0.886204 0.322126 0.008135 1.242282 1.047875 0.474705 0.182393 -1.621947 0.492116 0.510223 0.292110
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 8.801675 12.451677 9.052988 10.090898 11.225361 12.860962 11.269434 2.435670 0.026499 0.029880 0.001939
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.204531 -1.397789 -0.730828 0.202467 -0.352605 0.134866 -0.705711 -1.175253 0.543876 0.567222 0.359543
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.573987 0.649312 1.168577 -0.426663 0.693431 0.820271 11.068892 0.814779 0.527421 0.545927 0.349600
192 N16 digital_ok 100.00% 19.13% 18.12% 0.00% 6.575457 7.204253 4.509964 4.449459 8.171005 9.959716 -4.062323 -4.072569 0.431672 0.446032 0.285833
193 N16 digital_ok 100.00% 19.92% 18.12% 0.00% 7.586410 0.421605 4.728327 1.045126 8.586770 2.202653 -4.272048 -0.951372 0.417478 0.455598 0.308623
200 N18 RF_maintenance 100.00% 100.00% 79.12% 0.00% 12.249905 36.304012 3.944667 0.774577 11.274206 5.928199 0.794346 21.641297 0.037657 0.153042 0.093129
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.019426 5.311282 2.937502 3.887141 3.286377 8.193794 -1.460112 -3.306683 0.546556 0.546537 0.346681
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.763663 3.350171 1.500619 -1.198014 1.341727 -0.319373 -0.856438 25.545324 0.553594 0.537911 0.342198
205 N19 RF_ok 100.00% 0.56% 0.00% 0.00% 5.918206 1.079037 1.684660 -0.206746 4.821751 -0.548380 0.389238 7.976061 0.409948 0.530594 0.353213
206 N19 RF_ok 100.00% 0.00% 2.08% 0.00% -1.154507 7.291128 -0.894858 1.894403 8.189509 4.432079 -0.658351 0.067480 0.533067 0.442129 0.349787
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.219845 2.156841 -0.780551 -0.534984 -0.535997 6.641499 5.531531 -0.186998 0.537643 0.531448 0.334041
208 N20 dish_maintenance 100.00% 95.39% 95.55% 0.00% 19.795941 19.431569 14.572357 15.843569 157.846964 157.517422 21.485059 70.696565 0.118805 0.109383 0.076436
209 N20 dish_maintenance 100.00% 94.94% 95.33% 0.00% 17.622865 18.125868 14.443546 14.864949 157.814593 157.463929 19.260902 25.293519 0.128968 0.124751 0.077484
210 N20 dish_maintenance 100.00% 94.77% 95.55% 0.00% 17.290560 16.212299 5.837953 5.610033 157.721422 157.354307 7.127505 7.872190 0.127186 0.116795 0.076956
211 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.886611 2.249812 -1.328256 -0.143132 -0.608240 -0.137207 2.750883 -0.644624 0.487453 0.506728 0.329389
220 N18 RF_maintenance 0.00% 8.16% 7.82% 0.00% -1.268749 -1.231782 0.342556 -0.554570 -0.449871 -0.611700 2.102205 -1.554542 0.498179 0.506827 0.308972
221 N18 RF_ok 100.00% 8.55% 7.60% 0.00% 0.942132 -0.091929 -1.345590 -0.841870 0.456147 -0.867386 5.345837 -0.842721 0.481873 0.512053 0.312204
222 N18 RF_ok 0.00% 8.38% 7.48% 0.00% 0.486308 -0.099168 -0.360448 -0.008135 -0.155844 -0.693458 2.566071 -1.429092 0.492399 0.520344 0.315225
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.091835 -0.251101 -1.614950 0.244481 -0.539698 -0.599487 0.500780 2.260746 0.523066 0.564438 0.353503
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 8.088440 6.646543 4.988055 4.398730 9.096413 9.663377 -4.530152 -3.649707 0.518245 0.540610 0.342804
225 N19 RF_ok 100.00% 0.00% 97.92% 0.00% -0.651283 13.091363 0.565395 4.400630 -0.634463 12.459564 -1.703647 0.723258 0.546266 0.110976 0.436990
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.513304 18.674313 -0.616907 0.745427 -0.641811 6.958556 -1.259471 2.300311 0.533724 0.471988 0.333836
227 N20 RF_ok 100.00% 12.77% 11.54% 0.00% 2.058534 0.621186 -1.532368 -0.107735 -0.021386 -0.136711 13.241099 2.227573 0.449427 0.485145 0.299282
228 N20 RF_maintenance 100.00% 15.31% 17.33% 0.00% 9.107906 22.360864 -0.800124 -0.590912 3.717379 4.548377 85.009603 19.816166 0.393070 0.367136 0.220341
229 N20 RF_maintenance 0.00% 12.21% 12.04% 0.00% 1.047743 0.094801 1.433912 1.144374 0.531397 1.464553 -0.162520 -2.035639 0.463877 0.481951 0.311016
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.787152 0.061124 -0.182207 -1.583405 0.020670 -0.962207 -0.863774 -1.190843 0.472214 0.527077 0.351425
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.237935 -0.164290 0.814729 0.178318 -0.582033 -0.911035 -2.065055 -2.214980 0.533646 0.548267 0.353134
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.878336 -1.374522 -0.191652 -0.098602 -0.848287 -0.856570 2.068935 1.038475 0.531179 0.550706 0.352272
240 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.699269 0.266666 0.849452 1.225189 0.119703 0.651812 2.531564 3.032613 0.538569 0.559384 0.358289
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.432446 -0.923255 -0.479975 0.575456 -0.677349 -0.461119 0.374280 -1.515844 0.527436 0.555987 0.360736
242 N19 RF_ok 100.00% 2.48% 0.00% 0.00% 24.306331 0.936191 0.218833 1.445523 3.402879 2.101759 -1.243069 -0.871028 0.382239 0.547828 0.349559
243 N19 RF_ok 100.00% 7.88% 0.00% 0.00% 52.072944 -0.587792 0.591631 -1.582931 11.954824 -1.056245 21.785021 -0.067521 0.338380 0.524572 0.373528
244 N20 RF_maintenance 100.00% 4.67% 0.00% 0.00% 4.764692 2.135071 1.271403 -0.746616 3.623504 0.765074 2.869947 7.415004 0.394638 0.493294 0.331042
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.490846 2.048812 0.076310 -1.098496 -0.364692 -0.773001 -1.365057 -0.349535 0.500745 0.507621 0.337679
246 N20 RF_maintenance 100.00% 19.70% 19.30% 0.00% 9.499136 7.627760 -1.152037 -0.518093 5.107858 5.188630 1.549832 -0.632986 0.256620 0.254781 0.121079
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 1.568252 1.570999 0.575705 -0.611864 -0.363050 -1.192508 -1.035381 3.682017 0.497955 0.502739 0.340922
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 7.297694 8.212037 8.965062 9.494492 11.299283 11.517013 17.295562 17.738299 0.030299 0.025948 0.004091
320 N03 dish_maintenance 100.00% 8.38% 100.00% 0.00% 6.333315 13.392962 2.359632 6.675769 1.223341 12.883106 33.014481 2.366460 0.362871 0.043109 0.278453
324 N04 not_connected 0.00% 12.32% 7.15% 0.00% 1.789943 2.676856 0.920475 1.273320 1.114210 1.237036 0.871476 -0.537738 0.397044 0.413580 0.303226
325 N09 dish_ok 0.00% 0.45% 0.17% 0.00% 1.024948 -0.809033 1.052254 -1.533547 1.118837 -1.080570 -1.644372 -0.623517 0.433217 0.437775 0.325936
329 N12 dish_maintenance 100.00% 8.16% 0.00% 0.00% 5.369587 -0.307473 1.083865 -1.192728 2.476262 -1.248093 4.603204 0.813401 0.345107 0.447112 0.330284
333 N12 dish_maintenance 0.00% 2.19% 0.00% 0.00% 3.414695 2.120326 -0.675844 -1.543257 0.415472 -0.927948 0.336394 -0.103709 0.385502 0.426805 0.314175
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [3, 4, 5, 7, 8, 9, 10, 15, 16, 18, 27, 28, 29, 30, 32, 34, 36, 40, 42, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 63, 65, 66, 67, 68, 70, 71, 72, 74, 77, 78, 79, 80, 81, 82, 83, 84, 86, 87, 88, 90, 92, 94, 96, 97, 101, 102, 103, 104, 107, 108, 109, 110, 111, 113, 114, 117, 120, 121, 122, 123, 126, 128, 131, 135, 136, 142, 143, 144, 145, 150, 151, 155, 156, 158, 159, 161, 162, 165, 166, 167, 170, 171, 173, 179, 180, 182, 185, 186, 187, 189, 191, 192, 193, 200, 201, 202, 205, 206, 207, 208, 209, 210, 220, 221, 222, 224, 225, 226, 227, 228, 229, 242, 243, 244, 246, 262, 320, 324, 325, 329, 333]

unflagged_ants: [17, 19, 20, 21, 22, 31, 35, 37, 38, 41, 43, 44, 45, 46, 48, 61, 62, 64, 69, 73, 85, 89, 91, 93, 95, 105, 106, 112, 115, 118, 124, 125, 127, 132, 133, 137, 139, 140, 141, 146, 147, 148, 149, 157, 160, 163, 164, 168, 169, 181, 183, 184, 190, 211, 223, 237, 238, 239, 240, 241, 245, 261]

golden_ants: [17, 19, 20, 21, 31, 37, 38, 41, 44, 45, 69, 85, 91, 93, 105, 106, 112, 118, 124, 127, 140, 141, 146, 147, 148, 149, 157, 160, 163, 164, 168, 169, 181, 183, 184, 190]
In [23]:
# write to csv
outpath = os.path.join(nb_outdir, f'rtp_summary_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/rtp_summary_table_2459977.csv
In [24]:
# Load antenna positions
data_list = sorted(glob.glob(os.path.join(data_path, f'zen.{JD}.?????.sum.uvh5')))
hd = io.HERAData(data_list[len(data_list) // 2])

# Figure out where to draw the nodes
node_centers = {}
for node in sorted(set(list(nodes.values()))):
    if np.isfinite(node):
        this_node_ants = [ant for ant in ants + unused_ants if nodes[ant] == node]
        if len(this_node_ants) == 1:
            # put the node label just to the west of the lone antenna 
            node_centers[node] = hd.antpos[ant][node] + np.array([-14.6 / 2, 0, 0])
        else:
            # put the node label between the two antennas closest to the node center
            node_centers[node] = np.mean([hd.antpos[ant] for ant in this_node_ants], axis=0)
            closest_two_pos = sorted([hd.antpos[ant] for ant in this_node_ants], 
                                     key=lambda pos: np.linalg.norm(pos - node_centers[node]))[0:2]
            node_centers[node] = np.mean(closest_two_pos, axis=0)
In [25]:
def Plot_Array(ants, unused_ants, outriggers):
    plt.figure(figsize=(16,16))
    
    plt.scatter(np.array([hd.antpos[ant][0] for ant in hd.data_ants if ant in ants]), 
                np.array([hd.antpos[ant][1] for ant in hd.data_ants if ant in ants]), c='w', s=0)

    # connect every antenna to their node
    for ant in ants:
        if nodes[ant] in node_centers:
            plt.plot([hd.antpos[ant][0], node_centers[nodes[ant]][0]], 
                     [hd.antpos[ant][1], node_centers[nodes[ant]][1]], 'k', zorder=0)

    rc_color = '#0000ff'
    antm_color = '#ffa500'
    autom_color = '#ff1493'

    # Plot 
    unflagged_ants = []
    for i, ant in enumerate(ants):
        ant_has_flag = False
        # plot large blue annuli for redcal flags
        if use_redcal:
            if redcal_flagged_frac[ant] > 0:
                ant_has_flag = True
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=7 * (2 - 1 * float(not outriggers)), fill=True, lw=0,
                                                color=rc_color, alpha=redcal_flagged_frac[ant]))
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=6 * (2 - 1 * float(not outriggers)), fill=True, color='w'))
        
        # plot medium green annuli for ant_metrics flags
        if use_ant_metrics: 
            if ant_metrics_xants_frac_by_ant[ant] > 0:
                ant_has_flag = True
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=6 * (2 - 1 * float(not outriggers)), fill=True, lw=0,
                                                color=antm_color, alpha=ant_metrics_xants_frac_by_ant[ant]))
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=5 * (2 - 1 * float(not outriggers)), fill=True, color='w'))
        
        # plot small red annuli for auto_metrics
        if use_auto_metrics:
            if ant in auto_ex_ants:
                ant_has_flag = True                
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=5 * (2 - 1 * float(not outriggers)), fill=True, lw=0, color=autom_color)) 
        
        # plot black/white circles with black outlines for antennas
        plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=4 * (2 - 1 * float(not outriggers)), fill=True, color=['w', 'k'][ant_has_flag], ec='k'))
        if not ant_has_flag:
            unflagged_ants.append(ant)

        # label antennas, using apriori statuses if available
        try:
            bgc = matplotlib.colors.to_rgb(status_colors[a_priori_statuses[ant]])
            c = 'black' if (bgc[0]*0.299 + bgc[1]*0.587 + bgc[2]*0.114) > 186 / 256 else 'white'
        except:
            c = 'k'
            bgc='white'
        plt.text(hd.antpos[ant][0], hd.antpos[ant][1], str(ant), va='center', ha='center', color=c, backgroundcolor=bgc)

    # label nodes
    for node in sorted(set(list(nodes.values()))):
        if not np.isnan(node) and not np.all(np.isnan(node_centers[node])):
            plt.text(node_centers[node][0], node_centers[node][1], str(node), va='center', ha='center', bbox={'color': 'w', 'ec': 'k'})
    
    # build legend 
    legend_objs = []
    legend_labels = []
    
    # use circles for annuli 
    legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgecolor='k', markerfacecolor='w', markersize=13))
    legend_labels.append(f'{len(unflagged_ants)} / {len(ants)} Total {["Core", "Outrigger"][outriggers]} Antennas Never Flagged')
    legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markerfacecolor='k', markersize=15))
    legend_labels.append(f'{len(ants) - len(unflagged_ants)} Antennas {["Core", "Outrigger"][outriggers]} Flagged for Any Reason')

    if use_auto_metrics:
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgewidth=2, markeredgecolor=autom_color, markersize=15))
        legend_labels.append(f'{len([ant for ant in auto_ex_ants if ant in ants])} {["Core", "Outrigger"][outriggers]} Antennas Flagged by Auto Metrics')
    if use_ant_metrics: 
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgewidth=2, markeredgecolor=antm_color, markersize=15))
        legend_labels.append(f'{np.round(np.sum([frac for ant, frac in ant_metrics_xants_frac_by_ant.items() if ant in ants]), 2)} Antenna-Nights on' 
                             f'\n{np.sum([frac > 0 for ant, frac in ant_metrics_xants_frac_by_ant.items() if ant in ants])} {["Core", "Outrigger"][outriggers]} Antennas '
                             'Flagged by Ant Metrics\n(alpha indicates fraction of time)')        
    if use_redcal:
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgewidth=2, markeredgecolor=rc_color, markersize=15))
        legend_labels.append(f'{np.round(np.sum(list(redcal_flagged_frac.values())), 2)} Antenna-Nights on' 
                             f'\n{np.sum([frac > 0 for ant, frac in redcal_flagged_frac.items() if ant in ants])} {["Core", "Outrigger"][outriggers]} Antennas '
                             'Flagged by Redcal\n(alpha indicates fraction of time)')

    # use rectangular patches for a priori statuses that appear in the array
    for aps in sorted(list(set(list(a_priori_statuses.values())))):
        if aps != 'Not Found':
            legend_objs.append(plt.Circle((0, 0), radius=7, fill=True, color=status_colors[aps]))
            legend_labels.append(f'A Priori Status:\n{aps} ({[status for ant, status in a_priori_statuses.items() if ant in ants].count(aps)} {["Core", "Outrigger"][outriggers]} Antennas)')

    # label nodes as a white box with black outline
    if len(node_centers) > 0:
        legend_objs.append(matplotlib.patches.Patch(facecolor='w', edgecolor='k'))
        legend_labels.append('Node Number')

    if len(unused_ants) > 0:
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markerfacecolor='grey', markersize=15, alpha=.2))
        legend_labels.append(f'Anntenna Not In Data')
        
    
    plt.legend(legend_objs, legend_labels, ncol=2, fontsize='large', framealpha=1)
    
    if outriggers:
        pass
    else:
        plt.xlim([-200, 150])
        plt.ylim([-150, 150])        
       
    # set axis equal and label everything
    plt.axis('equal')
    plt.tight_layout()
    plt.title(f'Summary of {["Core", "Outrigger"][outriggers]} Antenna Statuses and Metrics on {JD}', size=20)    
    plt.xlabel("Antenna East-West Position (meters)", size=12)
    plt.ylabel("Antenna North-South Position (meters)", size=12)
    plt.xticks(fontsize=12)
    plt.yticks(fontsize=12)
    xlim = plt.gca().get_xlim()
    ylim = plt.gca().get_ylim()    
        
    # plot unused antennas
    plt.autoscale(False)    
    for ant in unused_ants:
        if nodes[ant] in node_centers:
            plt.plot([hd.antpos[ant][0], node_centers[nodes[ant]][0]], 
                     [hd.antpos[ant][1], node_centers[nodes[ant]][1]], 'k', alpha=.2, zorder=0)
        
        plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=4, fill=True, color='w', ec=None, alpha=1, zorder=0))
        plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=4, fill=True, color='grey', ec=None, alpha=.2, zorder=0))
        if hd.antpos[ant][0] < xlim[1] and hd.antpos[ant][0] > xlim[0]:
            if hd.antpos[ant][1] < ylim[1] and hd.antpos[ant][1] > ylim[0]:
                plt.text(hd.antpos[ant][0], hd.antpos[ant][1], str(ant), va='center', ha='center', color='k', alpha=.2) 

Figure 1: Array Plot of Flags and A Priori Statuses¶

This plot shows all antennas, which nodes they are connected to, and their a priori statuses (as the highlight text of their antenna numbers). It may also show (depending on what is finished running):

  • Whether they were flagged by auto_metrics (red circle) for bandpass shape, overall power, temporal variability, or temporal discontinuities. This is done in a binary fashion for the whole night.
  • Whether they were flagged by ant_metrics (green circle) as either dead (on either polarization) or crossed, with the transparency indicating the fraction of the night (i.e. number of files) that were flagged.
  • Whether they were flagged by redcal (blue circle) for high chi^2, with the transparency indicating the fraction of the night (i.e. number of files) that were flagged.

Note that the last fraction does not include antennas that were flagged before going into redcal due to their a priori status, for example.

In [26]:
core_ants = [ant for ant in ants if ant < 320]
outrigger_ants = [ant for ant in ants if ant >= 320]
Plot_Array(ants=core_ants, unused_ants=unused_ants, outriggers=False)
if len(outrigger_ants) > 0:
    Plot_Array(ants=outrigger_ants, unused_ants=sorted(set(unused_ants + core_ants)), outriggers=True)

Metadata¶

In [27]:
from hera_qm import __version__
print(__version__)
from hera_cal import __version__
print(__version__)
2.0.5.dev13+gd6c757c
3.2.1
In [ ]: